//
//  LLOrgCommentCell.m
//  BestLearning
//
//  Created by apple on 2017/3/10.
//  Copyright © 2017年 apple. All rights reserved.
//

#import "LLOrgCommentCell.h"

#import "ZYAddStrongCouseDetailFourModel.h"

@interface LLOrgCommentCell ()
@property (weak, nonatomic) IBOutlet UIImageView *iconImageView;  //头像
@property (weak, nonatomic) IBOutlet UILabel *userNameLabel;        //用户名

@property (weak, nonatomic) IBOutlet UIImageView *starImageView_1;
@property (weak, nonatomic) IBOutlet UIImageView *starImageView_2;
@property (weak, nonatomic) IBOutlet UIImageView *starImageView_3;
@property (weak, nonatomic) IBOutlet UIImageView *starImageView_4;
@property (weak, nonatomic) IBOutlet UIImageView *starImageView_5;

@property (weak, nonatomic) IBOutlet UILabel *dateLabel;    //评论时间
@property (weak, nonatomic) IBOutlet UILabel *contentLabel; //评论内容
@property (weak, nonatomic) IBOutlet UILabel *replyContentLabel;   //回复人和内容
@property (weak, nonatomic) IBOutlet UILabel *replyLabel;  //回复标签


@end

@implementation LLOrgCommentCell

- (void)awakeFromNib {
    [super awakeFromNib];
    

}


-(void)setCourseCommentModel:(ZYAddStrongCouseDetailFourModel *)courseCommentModel{
    
    _courseCommentModel = courseCommentModel;
    
    BOOL isUpFour = [NSString isBlankString:courseCommentModel.avatar];
    
    if (isUpFour) {
        self.iconImageView.image = [UIImage imageNamed:@"icon_user"];
    }else{
        [self.iconImageView sd_setImageWithURL:[NSURL URLWithString:courseCommentModel.avatar] placeholderImage:[UIImage imageNamed:@"icon_user"] options:0];
    }
    
    
    
    
    
    
    BOOL isUpThree = [NSString isBlankString:courseCommentModel.username];
    
    if (isUpThree) {
        self.userNameLabel.text = @"";
    }else{
        self.userNameLabel.text = [LLTools mobileSuitScanf:courseCommentModel.username];;
    }
    
    
    
    
    
    BOOL isUp = [NSString isBlankString:courseCommentModel.createTime];
    if (isUp) {
         self.dateLabel.text = @"";
    }else{
         self.dateLabel.text = courseCommentModel.createTime;
    }
    
   

    
    BOOL isUpTow = [NSString isBlankString:courseCommentModel.content];
    
    if (isUpTow) {
        self.contentLabel.text = @"";
    }else{
        self.contentLabel.text = courseCommentModel.content;
        
    }
    
    
    
    
    
    NSString *reply;
    
    //回复内容
    if (courseCommentModel.replyUsername == nil || courseCommentModel.replyContent == nil ||
        [courseCommentModel.replyUsername isKindOfClass:[NSNull class]] ||
        [courseCommentModel.replyContent isKindOfClass:[NSNull class]]) {
        
        
        [self.replyContentLabel removeFromSuperview];
        [self.replyLabel removeFromSuperview];
    }else{
    
        reply = [NSString stringWithFormat:@"%@回复: %@",courseCommentModel.replyUsername,courseCommentModel.replyContent];
        self.replyContentLabel.text = reply;
    }
    
    
    //评价等级 ⭐️
    NSInteger satisfy = [courseCommentModel.satisfy integerValue];
    switch (satisfy) {
        case 0:
            self.starImageView_1.hidden = YES;
            self.starImageView_2.hidden = YES;
            self.starImageView_3.hidden = YES;
            self.starImageView_4.hidden = YES;
            self.starImageView_5.hidden = YES;
            break;
        case 1:
            //self.starImageView_1.hidden = YES;
            self.starImageView_2.hidden = YES;
            self.starImageView_3.hidden = YES;
            self.starImageView_4.hidden = YES;
            self.starImageView_5.hidden = YES;
            break;
        case 2:
            //self.starImageView_1.hidden = YES;
            //self.starImageView_2.hidden = YES;
            self.starImageView_3.hidden = YES;
            self.starImageView_4.hidden = YES;
            self.starImageView_5.hidden = YES;
            break;
        case 3:
            //self.starImageView_1.hidden = YES;
            //self.starImageView_2.hidden = YES;
            //self.starImageView_3.hidden = YES;
            self.starImageView_4.hidden = YES;
            self.starImageView_5.hidden = YES;
            break;
        case 4:
            //self.starImageView_1.hidden = YES;
            //self.starImageView_2.hidden = YES;
            //self.starImageView_3.hidden = YES;
            //self.starImageView_4.hidden = YES;
            self.starImageView_5.hidden = YES;
            break;
        default:
            break;
    }
    
}

@end
